package io.jpress.service.provider;


import com.jfinal.core.paragetter.Para;
import com.jfinal.kit.Ret;
import com.jfinal.plugin.activerecord.Page;
import io.jboot.aop.annotation.Bean;
import io.jboot.db.model.Column;
import io.jboot.db.model.Columns;
import io.jboot.service.JbootServiceBase;
import io.jpress.commons.utils.SqlUtils;
import io.jpress.model.Attachment;
import io.jpress.service.AdvertService;
import io.jpress.service.AttachmentService;

import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.List;

@Bean
@Singleton
public class AdvertServiceProvider extends JbootServiceBase<Attachment> implements AdvertService {



    //按页码请求返回数据
    @Override
    public Page _paginate_pic(int page, int pagesize) {

        Columns columns = Columns.create();
        SqlUtils.likeAppend(columns, "mime_type", "image/");
        return DAO.paginateByColumns(page, pagesize, columns, "created desc");
    }

    @Override
    public Page _paginate_pic_newest(int page, int pagesieze) {

        //读取最近的几个图片，需要从后台读取配置
        return null;
    }

    @Override
    public Page _paginate_ved(int page, int pagesieze) {
        return null;
    }

    @Override
    public Page _paginate_pic_today(int page, int pagesieze) {
        return null;
    }

    @Override
    public Page _paginate_ved_today(int page, int pagesieze) {
        return null;
    }
}
